<template>
  <div class="my-header-container">
    <div class="header-title-box">
      <h3>劳务派遣监管专户数字信息化平台</h3>
    </div>
    <div class="header-person-info">
      <div class="info-left">
        <div>姓<span class="header-empty"></span>名：{{userName}}</div>
        <div>证件号：{{idCard}}</div>
      </div>
      <div class="info-right" v-if="myProp.isIndex">
        <div class="item" @click="toPersonCenterPage">
          <span>个人中心</span>
          <van-icon name="arrow" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'headCard',
  props: {
    myProp: Object
  },
  data () {
    return {
      userName: '',
      idCard: ''
    }
  },
  created () {
    this.userName = localStorage.getItem('userName')
    this.idCard = localStorage.getItem('idCard').replace(/(\w{6})\w*(\w{4})/, '$1********$2')
  },
  methods: {
    toPersonCenterPage () {
      this.$router.push('/personCenter')
    }
  }
}
</script>

<style lang="less" scoped>
.my-header-container {
  height: 170px;
  width: 94%;
  padding: 0 10px;
  background: linear-gradient(to right, #0f72fd, #36bffd);

  .header-title-box {
    padding: 10px 0 0 10px;
    font-size: 12px;

    h3 {
      color: #fff;
      line-height: 35px;
      font-size: 22px;
    }
  }

  .header-person-info {
    display: flex;
    width: 94%;
    margin: 0 20px;
    color: #fff;

    .info-left {
      flex: 70%;
      color: #9cc6fd;

      div {
        height: 25px;
        line-height: 25px;
      }

      .header-empty {
        display: inline-block;
        width: 14px;
      }
    }

    .info-right {
      flex: 30%;
      text-align: center;

      .item {
        height: 40px;
        line-height: 40px;
        margin: 5px 0;
        border-radius: 20px;
        cursor: pointer;
        background-color: #50c1fd;

        &:active {
          background-color: #28b2fd;
        }
      }

      span {
        display: inline-block;
        margin-right: 5px;
      }
    }
  }
}
</style>
